<template>
    <div>
        <Table  border :columns="columns" :data="tableData"></Table>
    </div>
</template>

<script>

export default {
    props: {
        tableData: Array,
        access: Object
    },
    data () {
        return {
            itemTotal: 0,
            columns: [
                {
                    title: '序号',
                    type: 'index',
                    width: 80,
                    align: 'center'
                },
                {
                    title: '用户名称',
                    align: 'center',
                    width: 100,
                    key: 'user_name'
                },
                {
                    title: '联系方式',
                    align: 'center',
                    width: 140,
                    key: 'user_mobile'
                },
                {
                    title: '身份证号',
                    align: 'center',
                    width: 260,
                    key: 'card_num'
                },
                {
                    title: '企业类型',
                    align: 'center',
                    width: 100,
                    key: 'partyType',
                    render: (h, params) => {
                        if (params.row.partyType === 1) {
                            return h('span', '2P')
                        }  else if(params.row.partyType === 2) {
                            return h('span', '4S')
                        } else if(params.row.partyType === 3) {
                            return h('span', '质押监管员')
                        }else if(params.row.partyType === 4) {
                            return h('span', '2B')
                        }else if(params.row.partyType === 5) {
                            return h('span', '小b')
                        }else if(params.row.partyType === 6) {
                            return h('span', '个人')
                        }else {
                            return h('span', '其他')
                        }
                    }
                },
                {
                    title: '企业名称',
                    align: 'center',
                    width: 300,
                    key: 'party_name'
                },
                {
                    title: '订单编号',
                    align: 'center',
                    width: 260,
                    key: 'order_no'
                },
                {
                    title: '交易订单编号',
                    align: 'center',
                    width: 260,
                    key: 'pay_no'
                },
                {
                    title: '支付类型',
                    align: 'center',
                    width: 100,
                    key: 'pay_type',
                    render: (h, params) => {
                        if (params.row.pay_type === 1) {
                            return h('span', '支付宝')
                        } else if(params.row.pay_type === 2) {
                            return h('span', '微信')
                        } else if(params.row.pay_type === 3) {
                            return h('span', '线下')
                        } else {
                            return h('span', '其他')
                        }
                    }
                },
                {
                    title: '支付用途',
                    align: 'center',
                    width: 100,
                    key: 'use_way',
                    render: (h, params) => {
                        if (params.row.use_way === 1) {
                            return h('span', '定金')
                        }  else if(params.row.use_way === 2) {
                            return h('span', '尾款')
                        } else {
                            return h('span', '其他')
                        }
                    }
                },
                {
                    title: '支付状态',
                    align: 'center',
                    width: 100,
                    key: 'status',
                    render: (h, params) => {
                        if (params.row.status === 0) {
                            return h('span', '未支付')
                        }  else if(params.row.status === 1) {
                            return h('span', '支付成功')
                        } else if(params.row.status === 2) {
                            return h('span', '支付失败')
                        } else if(params.row.status === 3) {
                            return h('span', '退款中')
                        } else if(params.row.status === 4) {
                            return h('span', '已退款')
                        } else {
                            return h('span', '其他')
                        }
                    }
                },
                {
                    title: '财务状态',
                    align: 'center',
                    width: 100,
                    key: 'financial_status',
                    render: (h, params) => {
                        if (params.row.financial_status === 1) {
                            return h('span', '已上传')
                        }  else if(params.row.financial_status === 2) {
                            return h('span', '已确认')
                        } else if(params.row.financial_status === 3) {
                            return h('span', '交易复核')
                        } else if(params.row.financial_status === 4) {
                            return h('span', '交易确认')
                        } else {
                            return h('span', '其他')
                        }
                    }
                },
                {
                    title: '价格',
                    align: 'center',
                    width: 100,
                    key: 'price'
                },
                {
                    title: '支付时间',
                    align: 'center',
                    width: 180,
                    key: 'crt_time'
                },
                {
                    title: '经销商',
                    align: 'center',
                    width: 100,
                    key: 'account_name'
                },
                {
                    title: '银行名称',
                    align: 'center',
                    width: 100,
                    key: 'bank_name'
                },
                {
                    title: '银行账号',
                    align: 'center',
                    width: 100,
                    key: 'bank_number'
                },
                {
                    title: '操作',
                    key: 'action',
                    width: 100,
                    align: 'center',
                    fixed: 'right',
                    render: (h, params) => {
                        return h('div', [
                            h(
                                'Button',
                                {
                                    props: {
                                        type: 'primary',
                                        size: 'small'
                                    },
                                    style: {
                                        marginRight:'5px'
                                    },
                                    on: {
                                        click: () => {
                                            this.finishorder(params.row.order_id)
                                        }
                                    }
                                },
                                '数据详情'
                            ),
                        ])
                    }
                }
               ],
        }
    },
    created () {
        this.init()
    },
    activated () {},
    methods: {
        init () {},
        // 进入详情页面
        finishorder(id){
            let argu = {
                id: id
            }
            this.$router.push({
                name: 'car_buying_detail',
                params: argu
            })
        },
    },
}
</script>


<style lang="less">
    @import "../less/editable-table.less";
</style>
